package com.hua.controller;

import com.hua.common.Response;
import com.hua.domain.MixIngredients;
import com.hua.domain.Teabottom;
import com.hua.service.MixIngredientsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @program: git
 * @description: 底料操作
 * @author: 黄燕峰
 * @create: 2022-10-21 20:22
 **/
@Api("底料操作")
@RestController
@RequestMapping("/ingredient")
public class IngredientController {
    @Resource
    private MixIngredientsService ingredientsService;

    @ApiOperation("获取所有底料")
    @GetMapping("/getIngredient")
    public Response<List<MixIngredients>> getIngredient() {
        return ingredientsService.getAll();
    }

    @ApiOperation(value = "增加底料")
    @PostMapping("/insertIngredient")
    public Response<String> insertTeaBottom(@RequestBody MixIngredients mixIngredients) {
        return ingredientsService.insertMixIngredient(mixIngredients);
    }

    @ApiOperation(value = "删除底料")
    @DeleteMapping("/delete/{id}")
    public Response<String> deleteById(@PathVariable("id") Integer id) {
        return ingredientsService.deleteById(id);
    }

    @ApiOperation(value = "修改茶底")
    @PutMapping("/update")
    public Response<String> update(@RequestBody MixIngredients mixIngredients) {
        return ingredientsService.updateMixIngredient(mixIngredients);
    }

}
